%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Markov Chain Sample Output
% Script written for MATLAB 5.0
%
% Chris Bartels
% 10/30/01
% Stat. 516
% University of Washington
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Seed the random number generator with value based on the current date and 
%   time.  This will give different sequences each time the script is run
rand('state', sum(100*clock));

% This will cycle through the states.
P1 = [ 0 1 0 ; 0 0 1; 1 0 0 ]
Markov_Chain( P1, 3, 12)

% Precipitation at Snoqualmie Falls
P2 = [ 0.602 0.398 ; 0.166 0.834]
Markov_Chain( P2, 1, 10)

% Radiation Damage example (2.32), this will settle to state 1 or 4.
P3 = [ 1 0 0 0 ; 2/3 0 1/3 0 ; 0 1/3 0 2/3 ; 0 0 0 1 ] 
Markov_Chain( P3, 2, 10)
